﻿namespace Web.Control.Member.My
{
    using System;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.Net;
    using System.Collections.Generic;
    using Lx.Web.Common.UI;
    using Lx.Web.Common.ControlsUI;
    using BLF.WWW_User.Users;
    using Wuqi.Webdiyer;
    using System.Xml;
    using System.IO;
    using System.Text;
    using BLF;
    using Model.WWW_User.User;
    using Model.WWW_User.Teach;

    /// <summary>
    /// 我是老师对老师的feedback
    /// </summary>
    public class SFeedback : BaseControl
    {       
        protected int RecordCount;
        protected int PageIndex = 1;
        protected Literal litCount;
        protected int PageSize = 15;
        protected Repeater rptFeedback;
        protected System.Globalization.CultureInfo cultureInfo;        
        /// <summary>
        /// 当前用户时区跨度（用户时区－480）
        /// </summary>
        protected double TZSpan;
        /// <summary>
        /// 我的昵称
        /// </summary>
        protected string nickname = "";
        /// <summary>
        /// 我的头像
        /// </summary>
        protected string Avatar = "";
        /// <summary>
        /// 我的编号
        /// </summary>
        protected string memberno = "";
        protected override void OnLoad(EventArgs e)
        {
            memberno = HttpContext.Current.User.Identity.Name;
            if (memberno == "")
            {
                Page.Response.Redirect("/user/login.htm?ReturnUrl=" + Page.Request.Url.AbsoluteUri);
                return;
            }
            if (!string.IsNullOrEmpty(Request["p"]))
            {
                if (Request["p"] == "L")
                {
                    PageIndex = 999;
                }
                else
                {
                    int.TryParse(Request["p"], out PageIndex);
                    if (PageIndex == 0)
                    {
                        PageIndex = 1;
                    }
                }
            }
            if (litCount != null) int.TryParse(litCount.Text, out PageSize);
            ArrayList arrList = BLF.WWW_User.Users.User.GetMySFeedback(memberno, PageIndex, PageSize);
            if (arrList != null)
            {
                cultureInfo = new System.Globalization.CultureInfo(Lx.Web.Common.UI.Globals.Language);
                RecordCount = (int)arrList[1];
                int pCount = (int)Math.Ceiling(((decimal)RecordCount) / ((decimal)PageSize));
                if (PageIndex > pCount) PageIndex = pCount;
                string Timezone = (string)arrList[2];
                double.TryParse(Timezone, out TZSpan);
                TZSpan = TZSpan - 480;
                nickname = (string)arrList[3];
                Avatar = (string)arrList[4];

                if (rptFeedback != null)
                {
                    rptFeedback.DataSource = arrList[0];
                    rptFeedback.DataBind();
                }
            }
            else {
                Response.End();
                return;
            }
            base.OnLoad(e);
        }        
    }
}